/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package commands;
import IA.*;
/**
 *
 * @author Jeremy
 */
public class CmdGetCustomersAtTable extends Command {
    int TableIndex;
    
    public CmdGetCustomersAtTable(InformationAggregator ia, int TableIndex) {
        super(ia);
        this.TableIndex = TableIndex;
    }
    
    @Override
    public Object execute() {
        if(ia.getTableCollection().getTable(TableIndex).getIsAvailable()) {
            return 0;
        }
        else {
            Service s = ia.getServiceCollection().ServiceByTable(TableIndex);
            if(s == null) return 0;
            else return s.getNumCustomers();
        }
    }
    
}
